package com.zgjkhis.modules.statistics.service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zgjkhis.modules.statistics.domain.DrugStatistics;
import com.zgjkhis.modules.statistics.domain.PigeonholeParam;
import com.zgjkhis.modules.statistics.req.StoreDrugRequest;
import com.zgjkhis.modules.statistics.resp.DrugStatisticsDto;
import com.zgjkhis.modules.system.domain.Drug;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 运营数据：药房药品
 * @Author yxl
 * @Description
 * @Date 2021/12/23 18:06
 **/
public interface StoreDrugMapper extends BaseMapper<DrugStatistics> {

    /**
     * 查询药品
     * @param request
     * @return
     */
    List<Drug> findDrug(@Param("request") StoreDrugRequest request);

    /**
     * 药品统计归档清单
     * @param param
     * @return
     */
    List<DrugStatistics> findDrugPigeonhole(@Param("param") PigeonholeParam param);

    /**
     * count
     * @param request
     * @return
     */
    int findDrugCount(@Param("request") StoreDrugRequest request);

    /**
     * 统计药品销量，销售额，成本，利润
     * @param request
     * @param drugId 药品id，查询总计传null
     * @return
     */
    DrugStatisticsDto findDrugStatistics(@Param("request") StoreDrugRequest request, @Param("drugId") Long drugId);

    /**
     * 查询归档记录
     * @param request
     * @param drugId 药品id
     * @return
     */
    DrugStatisticsDto findPigeonhole(@Param("request") StoreDrugRequest request, @Param("drugId") Long drugId);

    /**
     * 查询归档记录总计
     * @param request
     * @return
     */
    DrugStatisticsDto findPigeonholeSum(@Param("request") StoreDrugRequest request);

}
